﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ABulletFProperty : ABullet
{
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {

    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        GameObject target = collision.gameObject;
        Hit(target);
    }

    public override void Launch(Vector2 direction, Vector2 targetPosition, float speed = 0f)
    {
        throw new System.NotImplementedException();
    }

    protected override void Hit(GameObject target)
    {
        float damageResult = DamageTarget(target);
        if (damageResult >= 0)
        {
            this.damage -= damageResult;
            if (this.damage <= 0)
            {
                gameObject.SetActive(false);
                CreateBoom(transform.position);
            }
        }
        else
        {
            gameObject.SetActive(false);
            CreateBoom(transform.position);
        }

    }
}
